package top.fyxxxx.dbdesign.servlet;

import top.fyxxxx.dbdesign.dao.DBoperate;
import top.fyxxxx.dbdesign.data.PersonalData;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/setAdminServlet")
public class setAdminServlet extends HttpServlet {
    DBoperate dBoperate=DBoperate.getInstance();
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        long cid=Long.parseLong(request.getParameter("cid"));
        long uid=Long.parseLong(request.getParameter("uid"));
        PersonalData pd=dBoperate.getPersonalData(uid,cid);
        pd.setPower(pd.getPower()^2);
        dBoperate.updateJoinCourse(pd);
        request.getRequestDispatcher("/classMember.jsp").forward(request,response);
    }
}
